package io.kiki.sba.registry.server.clientInterface.node.service;

import io.kiki.sba.registry.api.Callback;
import io.kiki.sba.registry.api.exchange.NodeExchanger;
import io.kiki.sba.registry.api.exchange.message.Request;
import io.kiki.sba.registry.common.model.store.Url;
import org.springframework.beans.factory.annotation.Autowired;


public class ClientNodeServiceImpl implements ClientNodeService {
    @Autowired
    private NodeExchanger clientNodeExchanger;

    @Override
    public void pushWithCallback(Object object, Url url, Callback callback) {
        Request<Object> request = new Request<Object>() {
            @Override
            public Object getRequestBody() {
                return object;
            }

            @Override
            public Url getRequestUrl() {
                return url;
            }

            @Override
            public Callback getCallBack() {
                return callback;
            }
        };
        clientNodeExchanger.request(request);
    }
}
